import implementaciones.Hashtable;


public class HashTableSet implements WordSet{

    
    private Hashtable<String,String> theWordTree;
    
    public HashTableSet(){
        theWordTree = new Hashtable();
    }
    
    @Override
    public void add(Word wordObject) {
        if(!theWordTree.containsKey(wordObject.getWord())){
            theWordTree.put(wordObject.getWord(),wordObject.getType());
        }
    }

    @Override
    public Word get(Word word) {
        //Se revisa si la palabra existe
        String theWord = word.getWord();
        if (theWordTree.containsKey(theWord)){
            String theWordType = theWordTree.get(theWord);
            Word toReturn = new Word(theWord, theWordType);
            return toReturn;
        }else{
            return null;
        }
    }
        
}